<!--
 * @Author: your name
 * @Date: 2022-03-10 09:40:34
 * @LastEditTime: 2022-03-10 10:43:29
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \day10\2-时间.html
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        window.onload=function(){
          var d1=document.getElementById('d1');
        var  now =new Date().toDateString;
        console.log(now,'当前时间');
        setInterval(function() {
            d1.innerHTML=new Date().toLocaleString();
        }, 1000);  
        
        //获取结点
        
        var  back=document.getElementById('back');
        back.onclick=function(){
            history.back();
        }
    }
    </script>
</head>
<body>
    <div id="d1">111</div>
    <button id="back">返回上一个历史记录</button>
</body>
</html>